package best.driver.android.common.utils;

import android.text.TextUtils;
import best.driver.android.BuildConfig;
import best.driver.android.common.app.AppProxy;
import best.driver.android.common.app.AppProxyFactory;

public class StringUtils {
	public static String convertToSecretPhone(String phone) {
		if (phone == null || phone.length() != 11) {
			return null;
		} else {
			return phone.substring(0, 3) + "****" + phone.substring(7, 11);
		}
	}
	
	public static String convertToSecretCarnumber(String carNumber){
		if (carNumber == null || carNumber.length() != 7) {
			return "";
		} else {
			return carNumber.substring(0, 1) + "***" + carNumber.substring(4, 7);
		}
	}

	public static String generateFileUrl(String fileId) {
		if(!TextUtils.isEmpty(fileId)) {
			return AppProxyFactory.getProxy().getAppConfig().getApiHostUrl() + "v1/static_file/" + fileId;
		}
		return null;
	}
}
